<include file="public:header" /> 
<!--微信菜单管理首页 <include file="public:header" />  --> 

<link rel="stylesheet" type="text/css" href="__STATIC__/weixin/assets/sell/baseui/css/amazeui.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/weixin/assets/sell/baseui/css/admin.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/weixin/assets/sell/css/style.css"/>




<!--[if (gte IE 9)|!(IE)]><!-->
	<script type="text/javascript" src="//cdn.bootcss.com/jquery/2.2.2/jquery.min.js"></script>
	<script type="text/javascript" src="//cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js"></script>
  	<script>$(function() {FastClick.attach(document.body);});</script>
<!--<![endif]-->

<!--[if lte IE 8 ]>
	<script type="text/javascript" src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
	<script type="text/javascript" src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
	<script type="text/javascript" src="__STATIC__/weixin/assets/sell/baseui/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->

<script type="text/javascript" src="//cdn.bootcss.com/amazeui/2.7.2/js/amazeui.min.js"></script>


 
<div class="am-modal am-modal-alert" tabindex="-1" id="fq_alert">
  <div class="am-modal-dialog">
    <div class="am-modal-hd" id="fq_alert_title"></div>
    <div class="am-modal-bd" id="fq_alert_info">
    </div>
    <div class="am-modal-footer">
      <span class="am-modal-btn">确定</span>
    </div>
  </div>
</div>

<div class="am-modal am-modal-confirm" tabindex="-1" id="fq_confirm">
  <div class="am-modal-dialog">
    <div class="am-modal-hd" id="fq_confirm_title"></div>
    <div class="am-modal-bd" id="fq_confirm_info"></div>
    <div class="am-modal-footer">
      <span class="am-modal-btn" data-am-modal-confirm>确定</span>
    </div>
  </div>
</div>

<div class="am-modal am-modal-confirm" tabindex="-1" id="fq_true_confirm">
  <div class="am-modal-dialog">
    <div class="am-modal-hd" id="fq_true_confirm_title"></div>
    <div class="am-modal-bd" id="fq_true_confirm_info"></div>
    <div class="am-modal-footer">
		<span class="am-modal-btn" data-am-modal-confirm>确定</span>
		<span class="am-modal-btn" data-am-modal-cancel class="cancel">取消</span>
    </div>
  </div>
</div>
<script>
 
</script>
<style>
#replay_spinner{
	display:none;
	margin-left:10px;
}
.face{
	width:100%;
	height:20px;
	border-top:1px solid #e7e7eb;
}
/*eidtor*/
.wysiwyg-editor{
	width:100%;
	max-height:190px;
	height:190px;
	overflow-x:hidden;
	overflow-y:auto;
	outline:none;
}
.wysiwyg-toolbar.wysiwyg-toolbar-bottom{
	border-top:1px solid #e7e7eb;
	width:100%;
	height:28px;
}
.wxautoreply .faceNav{
	width: 20px;
	height: 20px;
	vertical-align: middle;
	display: inline-block;
	margin: -6px 0 0 9px;
	cursor: pointer;
	color: #8d8d8d;
}
.wxautoreply .faceNav:hover{
	color:#222;
}
.wysiwyg-popup{
	width:502px;
	background-color: #e7e7eb;
	border:1px solid #c0bfc5;
	z-index: 999;
}
.wysiwyg-popup img{
	border-bottom: 1px solid #c0bfc5;
	border-right: 1px solid #c0bfc5;
	float: left;
}
.image_show{
	display:none;
}
.media_del{
	display:none;
}
#media_image{
	display:none;
}
.material_image{
	width:150px;
	height:150px;
}
.add_warming{
	color:red;
	display:none;
	padding-left:10px;
	top:2px;
	position: relative;
}
</style>

 
<!-- alert -->
<div class="am-modal am-modal-alert" tabindex="-1" id="fq_alert">
  <div class="am-modal-dialog">
    <div class="am-modal-hd" id="fq_alert_title"></div>
    <div class="am-modal-bd" id="fq_alert_info">
    </div>
    <div class="am-modal-footer">
      <span class="am-modal-btn">确定</span>
    </div>
  </div>
</div>
<!-- alert end -->



<!-- content start -->
<div class="admin-content change_modal">
	<div class="admin-content-body">
    
		<div class="am-margin-top-sm am-margin-left">
			<strong class="am-text-primary am-text-lg">自动回复</strong> / <small>Autoreply list</small>
		</div>

		<div class="am-margin " style="display:none">
	  		<label class="am-checkbox">
	      		<input type="checkbox"  id="auto_replay" value="0" data-am-ucheck  checked>启用自动回复<i class="am-icon-spinner am-icon-spin" id="replay_spinner"></i>
    		</label>
	    	<div class="am-cf"></div>
		</div>
      	<div class="am-tabs am-margin" data-am-tabs="{noSwipe: 1}">
		    <ul class="am-tabs-nav am-nav am-nav-tabs keyword_nav">
			    <li class="am-active keylist"><a href="#tab1" class="keylist_sum">展示列表 （共<?php echo count($keywordList);?>条）</a></li>
			    <li class="move_edit"><a href="#tab2" class="add_keyword_bt edit_text">添加关键词</a></li>
		    </ul>
		    <div class="am-tabs-bd nav_content" style="touch-action: pan-y;  -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">
		        
		        <!--关键词添加 -->
		        <div class="am-tab-panel am-fade" id="tab2">
		              	<div class="am-g am-margin-top">
		                	<div class="am-u-sm-4 am-u-md-2 am-text-right">推荐关键词：</div>
		                	<div class="am-u-sm-8 am-u-md-10">
		                  		<div class="am-btn-group recommend_keyword" data-am-button="">
				                    <label class="am-btn am-btn-default am-btn-xs">
				                      <input type="radio" name="keyword" value="？"> ？
				                    </label>
				                    <label class="am-btn am-btn-default am-btn-xs">
				                      <input type="radio" name="keyword" value="你好">你好 
				                    </label>
				                    <label class="am-btn am-btn-default am-btn-xs">
				                      <input type="radio" name="keyword" value="帮助"> 帮助
				                    </label>
				                    <label class="am-btn am-btn-default am-btn-xs">
				                      <input type="radio" name="keyword" value="如何玩">如何玩
				                    </label>
				                    <label class="am-btn am-btn-default am-btn-xs">
				                      <input type="radio" name="keyword" value="使用说明">使用说明 
				                    </label>
			                  	</div>
		                	</div>
		              	</div>
		              	<div class="am-g am-margin-top">
			                <div class="am-u-sm-4 am-u-md-2 am-text-right" style="line-height:39px;">输入关键词：</div>
			                <div class="am-u-sm-8 am-u-md-10">
			                  	<div class="am-btn-group" data-am-button="">
			                    	<input type="text" class="am-form-field am-radius" placeholder="自定义关键词" name="keyword[]" id="input_keyword">
			                    	
			                  	</div>
			                </div>
		              	</div>
		              	<!-- 额外选项 -->
		              	<div class="am-g am-margin-top" style="line-height:39px;display:none"  >
			                <div class="am-u-sm-4 am-u-md-2 am-text-right">额外选项：</div>
			                <div class="am-u-sm-8 am-u-md-10" style="position:relative;top:-2px;">
			                  	<label class="am-checkbox-inline">
									<input type="checkbox"  value="" data-am-ucheck class="default">关键字无匹配回复
								</label>
								&nbsp;&nbsp;&nbsp;
								<label class="am-checkbox-inline">
									<input type="checkbox"  value="" data-am-ucheck class="welcome">设为欢迎信息
								</label>
			                </div>
		              	</div>
		              	<!-- 额外选项 -->
							<!-- 额外选项 -->
		              	<div class="am-g am-margin-top" style="line-height:39px; "  >
			                <div class="am-u-sm-4 am-u-md-2 am-text-right">内部标签：</div>
			                <div class="am-u-sm-8 am-u-md-10" style="position:relative;top:-2px;">
			                  	 需要换行的地方加入 :[内部换行] 
			                </div>
		              	</div>
						
		              	<div class="am-g am-margin-top">
			                <div class="am-u-sm-4 am-u-md-2 am-text-right" style="line-height:39px;">回复类型及内容：</div>
			                <div class="am-u-sm-8 am-u-md-10">
				                <div class="menu_content send jsMain reply_content" id="edit" style="display: block;">
	            					<div class="msg_sender" id="eidtDiv">
	            						<div class="msg_tab">
	            							<div class="tab_navs_panel">
	            								<span class="tab_navs_switch_wrp switch_prev js_switch_prev">
	            									<span class="tab_navs_switch"></span>
	            								</span>
	            								<span class="tab_navs_switch_wrp switch_next js_switch_next" style="display:none;">
	            									<span class="tab_navs_switch"></span>
	            								</span>
	            								<div class="tab_navs_wrp">
	            									<ul class="tab_navs js_tab_navs" style="margin-left:0;">
	            										<li class="tab_nav tab_appmsg width4 selected del_news_bd add_appmsg" data-type="3" data-tab=".js_appmsgArea" data-tooltip="图文消息">
	            											<a href="javascript:void(0);" onclick="return false;">&nbsp;
		            											<i class="icon_msg_sender"></i>
		            											<span class="msg_tab_title">图文消息</span>
	            											</a>
	            										</li>
	            										<li class="tab_nav tab_img width4 del_image_bd add_image" data-type="2" data-tab=".js_imgArea" data-tooltip="图片">
	            											<a href="javascript:void(0);" onclick="return false;">&nbsp;
		            											<i class="icon_msg_sender"></i>
		            											<span class="msg_tab_title">图片</span>
	            											</a>
	            										</li>
	            										<li class="tab_nav tab_text width4 no_extra add_text" data-type="1" data-tab=".js_textArea" data-tooltip="文字">
	            											<a href="javascript:void(0);" onclick="return false;">&nbsp;
		            											<i class="icon_msg_sender"></i>
		            											<span class="msg_tab_title">文字</span>
	            											</a>
	            										</li>
	            									</ul>
	            								</div>
	            							</div>
	            							<div class="tab_panel">
		    									<div class="tab_content" style="display:none;">
													<div class="js_textArea inner wxautoreply">
														<div class="text_cover" style="width:100%;border:1px solid #e7e7eb;">
															<textarea id="editor1" name="editor"></textarea>
															<div class="facebox" style="position:relative;"></div>
														</div>
												   	</div>
												</div>

												<div class="tab_content">
													<div class="js_appmsgArea inner ">
												   			
														<div class="tab_cont_cover jsMsgSendTab" data-index="0">
											            	<div class="media_cover news_cover">
														        <div class="create_access type_news del_news_bd">
														            <a class="add_gray_wrp jsMsgSenderPopBt" href="javascript:void(0);" data-type="3" data-index="0" data-am-modal="{target: '#doc-modal-news', closeViaDimmer: 0, width: 1000, height:800}">
											                            <i class="icon36_common add_gray"></i>
											                            <strong>从素材库中选择</strong>
											                        </a>
														        </div>
											                </div>
														    <div class="media_cover news_cover">
														        <div class="create_access">
											                    	<a class="add_gray_wrp" href="index.php?m=Admin&c=Weixin&a=wxmaterialcreatenews" target="_blank">
														                <i class="icon36_common add_gray"></i>
														                <strong>新建图文消息</strong>
														            </a>
														        </div>
														    </div>
														   
														    <div class="show_place news_show" data-id=""></div>
														    <a href="javascript:void(0);" class="media_del news_del" title="图文" data-type='3'>删除</a>
														</div>	    				
												   	</div>
												</div>
												    
												<div class="tab_content" style="display: none;">
												    <div class="js_imgArea inner ">
												    		<!--type 3图文 2图片 4语音 5视频 -->
											            <div class="tab_cont_cover jsMsgSendTab" data-index="1" data-type="2">
											                <div class="media_cover image_cover">
														        <div class="create_access del_image_bd">
														            <a class="add_gray_wrp jsMsgSenderPopBt image_model" data-type="2" href="javascript:void(0);" data-index="1" data-am-modal="{target: '#doc-modal-image', closeViaDimmer: 0, width: 800, height:800}">
											                            <i class="icon36_common add_gray"></i>
											                            <strong>从素材库中选择</strong>
											                        </a>
														        </div>
											                </div>
											                <div class="media_cover image_cover">
														        <div class="create_access">
														            <a class="add_gray_wrp" id="msgSendImgUploadBt" data-type="2" href="javascript:void(0);">
											                            <i class="icon36_common add_gray"></i>
											                            <strong>上传图片</strong>
											                        </a>
														        </div>
											                </div>
											                <div class="del_hide">
												                <div class="image_show show_place">
												                	<div class="waiting">
												                		<i class="am-icon-refresh am-icon-spin am-icon-md"></i> 上传中,请稍候
												                	</div>
												                </div>
												                <a href="javascript:void(0);" class="media_del image_del" title="图片" data-type='2' display="none">删除</a>
											                </div>
											            </div>
												    		
												   	</div>
												</div>
											</div>
	                     				</div>
	            					</div>
	            				</div>
            				</div>
		              	</div>
		              	<div class="am-g am-margin-top">
			                <div class="am-u-sm-4 am-u-md-2 am-text-right"></div>
			                <div class="am-u-sm-8 am-u-md-10">
			                  	<div class="am-btn-group" data-am-button="">
			                    	<button type="button" class="am-btn am-btn-secondary" id="check_keyword" data-id="" data-type="3" data-title='' data-src="" data-url="" data-content="" data-edit="0" data-media_id="" style="margin-right:5px;">提交保存</button>
		              			  
			                  	</div> <span class="add_warming">关键词不能为空</span>
			                </div>
		              	</div>
		            <form method="post" enctype="multipart/form-data" action="index.php?m=Admin&c=Weixin&a=localimage" id="imageUpload">
						<input type="file" name="upload_image" id="media_image"   accept="image/*">
					</form>
		            <br><br><br><br>
		        </div>

		        <!--关键词列表 -->
		        <div class="am-tab-panel am-fade am-active am-in" id="tab1">
		            <div class="am-g am-margin-top">
		                <div class="am-u-sm-12">
		                    <div class="am-g">
		          				<div class="am-u-sm-12">
		            				<div class="am-btn-toolbar">
			              				<div class="am-btn-group am-btn-group-xs" id="delete_all" style="cursor:pointer">
			                			<i class="am-icon-trash am-icon-fw"></i>删除选中
			              				</div>
										<form action="/wxautoreply/index.html" method="get">
								<div class="am-fr am-margin-right-xs" style="width:300px;margin-right:-4px;" id="keyword_search">
		            				<div class="am-input-group am-input-group-sm">
						              	<input type="text" class="am-form-field" name="search" placeholder="请输入关键词" value="" style="height:37px;">
						              	<span class="am-input-group-btn">
						              		<input class="am-btn am-btn-default" type="submit" value="搜索"  style="height:37px;">
						              	</span>
		            				</div>
		          				</div>
					          	<div class="am-fr am-margin-right">
					            	<div class="type_search">
					              		<select data-am-selected  name="search_type" onchange="select_type()" id="my_select" style="background-color:#fff;">
											<option value="0" selected>全部</option>
					                		<option value="1">文字</option>
							                <option value="2">图片</option>
							                <option value="3">图文</option>
							            </select>
		            				</div>
		          				</div>
		        				</form>
		            				</div>
		          				</div>
		        			</div>
		        		</div>
						<div id="keyword_list">
					        <table class="am-table am-table-striped am-table-hover table-main table_th_center">
					        <thead>
					        <tr>
					          <th class="table-check">
					          	<label class="am-checkbox-inline" style="margin-bottom:21px;">
								<input type="checkbox" value="" data-am-ucheck="" class="default am-ucheck-checkbox" id="selectAll" ><span class="am-ucheck-icons" style="opacity: 0;"><i class="am-icon-unchecked"></i><i class="am-icon-checked"></i></span>
								</label>
					          </th>
					          <th class="table-id">编号</th>
					          <th class="table-title">关键词</th>
					          <th class="table-type">回复类别</th>
					          <th class="table-author am-hide-sm-only">回复内容</th>
					          <th class="table-date am-hide-sm-only">新增时间</th>
					          <th class="table-set am-text-center">操作</th>
					        </tr>
					        </thead>
					        <tbody class="get_keywordlist_tip">
							
							<volist name="keywordList" id="vo">
							<tr id="{$vo.id}">
					            <td>
					            	<label class="am-checkbox-inline" style="margin-bottom:21px;">
									<input type="checkbox" data-am-ucheck="" class="default am-ucheck-checkbox cbox" name="idarr[]" value="{$vo.id}" /><span class="am-ucheck-icons" style="opacity: 0;"><i class="am-icon-unchecked"></i><i class="am-icon-checked"></i></span>
									</label>
					            </td>
					            <td class="edit_id">{$vo.id}</td>
					            <td style="width:15%;" id="keyword{$vo.id}">
									<if condition="($vo.type eq 1)  ">  
										<a data-editkeyword="{$vo.keyword}" data-edittype="{$vo.type}" data-editsrc="" data-editmedia_id="" data-edittitle="" data-content="{$vo.content}" data-editid="{$vo.id}" data-id="{$vo.id}" data-default="{$vo.default}" data-welcome="{$vo.welcome}" href="javascript:void(0);" class="list_keyword edit">{$vo.keyword}<div></div> </a>
									</if>
									<if condition="($vo.type eq 2)  ">  
										<a data-editkeyword="{$vo.keyword}" data-edittype="{$vo.type}" data-editsrc="{$vo.src}" data-editmedia_id="{$vo.media_id}" data-edittitle="" data-content="{$vo.content}" data-editid="{$vo.id}" data-id="{$vo.id}" data-default="{$vo.default}" data-welcome="{$vo.welcome}" href="javascript:void(0);" class="list_keyword edit">{$vo.keyword}<div></div> </a>
									</if> 
									<if condition="($vo.type eq 3)  ">  
										<a data-editkeyword="{$vo.keyword}" data-edittype="{$vo.type}" data-editsrc="{$vo.url|htmlspecialchars}" data-editmedia_id="{$vo.media_id}" data-edittitle="{$vo.title}" data-content="" data-editid="{$vo.id}" data-id="{$vo.id}" data-default="{$vo.default}" data-welcome="{$vo.welcome}" href="javascript:void(0);" class="list_keyword edit">{$vo.keyword}<div></div> </a>
									</if> 
					            </td>
					            <td style="width:10%;" id="type{$vo.id}"  class="list_type">
						             <if condition="($vo.type eq 1)  ">文字</if><if condition="($vo.type eq 2)  ">图片</if><if condition="($vo.type eq 3)  ">图文</if>
									</td>
					            <td class="am-hide-sm-only list_content" id="content{$vo.id}">
					            	  <if condition="($vo.type eq 1)  ">{$vo["content"]|htmlspecialchars_decode}</if> 
									<if condition="($vo.type eq 2)  "><img width='118px' height='118px' src="{$TencentPicturePre}{$vo.src}"/> </if> 
									<if condition="($vo.type eq 3)  "><div class='keylist_news' style='background-image:{$vo.url}'></div>
										    	<p class='keylist_title'>{$vo["title"]}</p></if> 
									</td>   

					            <td class="am-hide-sm-only" style="width:15%;"> {$vo["add_time"]|date="Y-m-d H:i:s",###}</td>
					            <td style="width:20%;text-align:center;">
					                <div class="am-btn-toolbar clear">
					                    <div class="am-btn-group am-btn-group-xs clear"  style="margin-left: 27px;"> 
					                       <if condition="($vo.type eq 1)  ">  
											   <button type="button" class="am-btn am-btn-secondary edit" data-editkeyword="{$vo.keyword}" 
											   data-edittype="{$vo.type}" data-editsrc="" data-editmedia_id="" data-edittitle="" 
											   data-content="{$vo.content}" data-editid="{$vo.id}" data-id="{$vo.id}" 
											   data-default="{$vo.default}" data-welcome="{$vo.welcome}">
											   <span class="am-icon-pencil-square-o"></span> 编辑</button> 
										   </if> 
										   <if condition="($vo.type eq 2)  ">  
											   <button type="button" class="am-btn am-btn-secondary edit" data-editkeyword="{$vo.keyword}" 
											   data-edittype="{$vo.type}" data-editsrc="{$TencentPicturePre}{$vo.src}" data-editmedia_id="{$vo.media_id}" data-edittitle="" 
											   data-content="{$vo.content}" data-editid="{$vo.id}" data-id="{$vo.id}" 
											   data-default="{$vo.default}" data-welcome="{$vo.welcome}">
											   <span class="am-icon-pencil-square-o"></span> 编辑</button> 
										   </if> 
					                     <if condition="($vo.type eq 3)  ">  
											   <button type="button" class="am-btn am-btn-secondary edit" data-editkeyword="{$vo.keyword}" 
											   data-edittype="{$vo.type}" data-editsrc="{$vo.url|htmlspecialchars}" data-editmedia_id="{$vo.media_id}" data-edittitle="{$vo.title}" 
											   data-content="" data-editid="{$vo.id}" data-id="{$vo.id}" 
											   data-default="{$vo.default}" data-welcome="{$vo.welcome}">
											   <span class="am-icon-pencil-square-o"></span> 编辑</button> 
										   </if> 
										 <button class="am-btn am-btn-danger am-hide-sm-only del del511" data-id="{$vo.id}" style="width:65.2969px;margin-left:0.5px;"><span class="am-icon-trash-o"></span> 删除</button>
					                    </div>
					                </div>
					            </td>
					        </tr>
							</volist>
					        </tbody>
					        </table>
					        <div class="am-cf"></div>
								<ul class="am-pagination am-pagination-centered am-text-xs">    </ul>
					                 
		    			</div>
		        	</div>	
		       	</div>                
		    </div>
		</div>	
	</div>
	<!--回复文字项 star-->
	<!--回复文字项 end-->
	<!--回复图片项 star-->
	<!--回复图片项 end-->
	<!--回复图文项 star-->
	<style type="text/css">	
.appmsg_content {
	position:relative;
	width:320px;
	border: 1px solid #e7e7eb;
}
.appmsg_info {
	font-size:13px;
	line-height:20px;
	padding:12px 14px 0;
}
.appmsg_item {
	position:relative;
	padding:12px 14px;
}
.appmsg_date {
	font-weight:400;
	font-style:normal;
}
.appmsg_title {
	margin:0;
	font-weight:400;
	font-style:normal;
	font-size:14px;
	line-height:28px;
	max-height:56px;
	overflow:hidden;
	word-wrap:break-word;
	word-break:break-all;
	color:#222;
	text-align:left;
}
.appmsg_thumb_wrp {
	height:160px;
	overflow:hidden;
	background-repeat: no-repeat;
	background-position:center center;
	background-size:cover;
}
.appmsg_desc {
	padding:5px 0 10px;
	margin:0;
	word-wrap:break-word;
	word-break:break-all;
}
.appmsg_content .cover_appmsg_item {
	position:relative;
	margin:22px 14px;
}
.cover_appmsg_item .appmsg_title {
	font-size:14px;
	position:absolute;
	bottom:0;
	left:0;
	right:0;
	background:rgba(0,0,0,0.6)!important;
}
.cover_appmsg_item .appmsg_title a {
	color:#fff;
}
.has_cover {
	height:102px;
	border-top:1px solid #e7e7eb;
}
.has_cover .appmsg_thumb_wrp {
	float:right;
	width:78px;
	height:78px;
	margin-left:14px;
	margin:0;
}
.has_cover .appmsg_title {
	display:inline-block;
	width:200px;
	line-height:24px;
	max-height:48px;
	overflow: hidden;
	margin-top:14px;
}
.appmsg_title a {
	display:block;
	padding:0 8px;
	color:#222;
}
.newsbox {
	width:30%;
	height:100%;
	float:left;
	margin:0 15px;
}
.newsbox .appmsg_content {
	width:100%	}
.newsbox .appmsg_title a {
	text-align:left;
}
.newsbox .has_cover .appmsg_title {
	width:180px;
}
.newsbox .appmsg_info {
	text-align: left;
}
.newsbox .appmsg_desc {
	text-align: left;
}
.newsDesc {
	position:relative;
	margin-bottom:20px;
}
.chooseNew {
	position:absolute;
	top:0;
	left:0;
	right:0;
	bottom:0;
	background-color:rgba(0,0,0,0.6);
	z-index:999;
	display:none;
}
.news_table {
	padding:15px 10px;
	height:80%;
	overflow:hidden;
	margin:0;
}
.news_content_box .mT {
	margin-top:25%;
}
.loading {
	display:block;
}
.news_content_box {
	border:1px solid #e7e7eb;
	padding:15px 0;
}
.choose_icon {
	background: transparent url(__STATIC__/weixin/assets/sell/images/selected_mask_icon.png) no-repeat 0 0;
	width: 45px;
	height: 38px;
	position:absolute;
	top:45%;
	left:43%;
}
<!--删除修改样式开始-->	.grid_item.no_extra {
	float: none;
	width: auto;
	overflow: hidden;
}
.appmsg_opr_item {
	line-height: 44px;
	height: 44px;
	width:148px;
}
.newsbox ul {
	border-bottom: 1px solid #e7e7eb;
	border-right: 1px solid #e7e7eb;
	border-left: 1px solid #e7e7eb;
	padding-left: 0px;
	background:#e7e7eb;
	margin-bottom:20px;
	position: relative;
}
.newsbox li {
	float:left;
}
.right_del:hover {
	color:#000;
}
.li_left {
	border-right:0.5px solid #ccc;
	cursor:pointer;
}
.li_right {
	cursor:pointer;
}
<!--警告框样式开始-->	.popover {
	width: 290px;
}
.del_confirm .popover {
	display:none;
	position: absolute;
	margin-top: 12px;
	z-index:2001;
}
.del_confirm .popover .popover_inner {
	border: 1px solid #d9dadc;
	word-wrap: break-word;
	word-break: break-all;
	padding: 30px;
	background-color: #fff;
	-webkit-box-shadow: none;
	width:216px;
	height:136px;
}
.tl {
	text-align: left;
}
.del_confirm .popover_content p {
	display: block;
	-webkit-margin-before: 1em;
	-webkit-margin-after: 1em;
	-webkit-margin-start: 0px;
	-webkit-margin-end: 0px;
	margin: 0;
}
.popover .popover_bar {
	text-align: justify;
	text-justify: distribute-all-lines;
	font-size: 0;
	width:100%;
}
.popover .popover_bar .btn {
	/*margin-top: 18px;*/
	
}
.btn {
	min-width: 60px;
	display: inline-block;
	overflow: visible;
	padding: 0 22px;
	height: 30px;
	line-height: 30px;
	vertical-align: middle;
	text-align: center;
	text-decoration: none;
	border-radius: 3px;
	-moz-border-radius: 3px;
	-webkit-border-radius: 3px;
	font-size: 14px;
	border-width: 1px;
	border-style: solid;
	cursor: pointer;
	margin-left:12px;
}
.btn_primary {
	background-color: #44b549;
	background-image: -moz-linear-gradient(top,#44b549 0,#44b549 100%);
	background-image: -webkit-gradient(linear,0 0,0 100%,from(#44b549),to(#44b549));
	background-image: -webkit-linear-gradient(top,#44b549 0,#44b549 100%);
	background-image: -o-linear-gradient(top,#44b549 0,#44b549 100%);
	background-image: linear-gradient(to bottom,#44b549 0,#44b549 100%);
	border-color: #44b549;
	color: #fff;
	margin-top:18px;
	margin-left:0px;
}
.popover_bar a {
	outline: 0;
}
.btn_primary:hover {
	color:fff;
}
.btn_default:hover {
	background-color: #e7e7eb;
	background-image: -moz-linear-gradient(top,#e7e7eb 0,#e7e7eb 100%);
	background-image: -webkit-gradient(linear,0 0,0 100%,from(#e7e7eb),to(#e7e7eb));
	background-image: -webkit-linear-gradient(top,#e7e7eb 0,#e7e7eb 100%);
	background-image: -o-linear-gradient(top,#e7e7eb 0,#e7e7eb 100%);
	background-image: linear-gradient(to bottom,#e7e7eb 0,#e7e7eb 100%);
	border-color: #dadbe0;
	box-shadow: none;
	-moz-box-shadow: none;
	-webkit-box-shadow: none;
	color: #000;
	!important
}
.btn_default {
	margin-top:18px;
	margin-right:-10px;
	border:#e7e7eb solid 1px;
	color:#000;
}
.btn:hover {
	text-decoration: none;
}
.t1 {
	font-size:14px;
}
.del_confirm .popover .popover_arrow_out {
	top: 0;
}
.del_confirm .popover .popover_arrow {
	position: absolute;
	left: 50%;
	margin-left: -8px;
	margin-top: -8px;
	display: inline-block;
	width: 0;
	height: 0;
	border-width: 8px;
	border-style: dashed;
	border-color: transparent;
	border-top-width: 0;
	border-bottom-color: #d9dadc;
	border-bottom-style: solid;
}
.del_confirm .popover .popover_arrow_in {
	border-bottom-color: #fff;
	top: 1px;
}
.edit_confirm .speech-bubble {
	display:none;
	position: absolute;
	background-color: #666;
	margin-left: auto;
	margin-right: auto;
	width: 35px;
	height: 27px;
	line-height: 27px;
	/* 垂直居中*/
	color: white;
	text-align: center;
	/*border-radius: 10px;
	font-family: sans-serif;*/
	bottom:55px;
	left:55px;
}
.edit_confirm p {
	font-size:12px;
}
.edit_confirm .speech-bubble:after {
	content: '';
	position: absolute;
	width: 0;
	height: 0;
	border: 5px solid;
}
.edit_confirm .speech-bubble-bottom:after {
	border-top-color: #666;
	top: 100%;
	left: 74%;
	margin-left: -15px;
}
.del_confirm .speech-bubble {
	display:none;
	position: absolute;
	background-color: #666;
	margin-left: auto;
	margin-right: auto;
	width: 35px;
	height: 27px;
	line-height: 27px;
	/* 垂直居中*/
	color: white;
	text-align: center;
	/*border-radius: 10px;
	font-family: sans-serif;*/
	bottom:55px;
	right:51px;
}
.del_confirm p {
	font-size:12px;
}
.del_confirm .speech-bubble:after {
	content: '';
	position: absolute;
	width: 0;
	height: 0;
	border: 5px solid;
}
.del_confirm .speech-bubble-bottom:after {
	border-top-color: #666;
	top: 100%;
	left: 74%;
	margin-left: -15px;
}
<!--警告框样式结束-->	<!--介绍-->
</style>

<link rel="stylesheet" type="text/css" href="__STATIC__/weixin/assets/sell/css/wxkeyword.css" />
<!--回复图文项 start-->
	<div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-news" data-id="3">
		<div class="am-modal-dialog">
		   	<div class="am-modal-hd modal-hd-top">
		   		选择图文素材
		        <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close="">×</a>
		    </div>
		    <div class="am-cf">
				<button type="button" style="background:#5eb95e;border-color:#5eb95e;border-radius:3px;" class="am-margin-sm am-fl am-btn am-btn-secondary type_news getMaterial">重新获取图文</button>
				<button type="submit" class="am-fl am-btn am-margin-sm am-btn-secondary" id="material_up" style="display:none;margin-left:0px;background:#5eb95e;border-color:#5eb95e; border-radius:3px;" disabled data-start="">上一页</button>
				<button type="submit" class="am-fl am-margin-sm am-btn am-btn-secondary" style="margin-left:0px;background:#5eb95e;border-color:#5eb95e;border-radius:3px;display:none;"  id="material_down" data-start="">下一页
				</button>
				<button type="button" class="am-btn am-btn-secondary" style="float:right;margin-right:21px;margin-top:10px;"><a href="index.php?m=Admin&c=Weixin&a=wxmaterialcreatenews" target="_blank" style="color:#fff;">+ 新建图文消息</a></button>
		    </div>
		    <div class="news_table">
		    	<div class="news_content_box" style="width:100%;height:100%;overflow:overlay;">
		    		<div class="loading mT">
		    			<i class="am-icon-refresh am-icon-spin am-icon-md"></i> 获取中,请稍候
		    		</div>
		    	</div>
		    </div>
		    <button type="submit" class="am-btn am-btn-secondary am-disabled" data-am-modal-close="" data-id="" id="edit_news" data-src="" data-title="" data-edit="0">确认选择</button>
		    <button type="reset" class="am-btn am-btn-secondary" style="width:98px;" data-am-modal-close="" class="modal-close">取&nbsp;&nbsp;消</button>
		</div>
	</div>
	<!--回复图文项 end-->
	
	
	<!--回复图片项 star-->
	<div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-image" data-id="2">
    
		<div class="am-modal-dialog">
		   	<div class="am-modal-hd modal-hd-top">选择图片
		        <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close="">×</a>
		    </div>
		    <div class="image_table">
		    	<form method="post" enctype="multipart/form-data" name="form_image" id="image_upload" action="index.php?m=Admin&c=Weixin&a=localimage" style="display:none;" >
						<input type="file" name="upload_image" value="" class="addimage" style="opacity:0" id="upload_image"  accept="image/*" multiple="multiple"/>
					</form>
		    	<div class="file_local"> 
					<button type="button" id="image_agin" class="image_model am-fl am-btn am-btn-secondary" style="margin-left:10px;border-radius:3px;background:#5eb95e;border-color:#5eb95e;" >重新获取图片</button>
					<button id="last_image" type="button" class=" am-fl am-btn am-btn-secondary" disabled style="margin-left:10px;background:#5eb95e;border-color:#5eb95e;display:none;border-radius:3px;" data-start="" />上一页
					</button>
					<button id="next_image" type="button" class="am-fl am-btn am-btn-secondary" style="display:none;margin-left:10px;background:#5eb95e;border-color:#5eb95e;border-radius:3px;" data-start="" />下一页
					</button>
		    		<button type="button" class="am-btn am-btn-secondary file_image" style="float:right;margin-right:10px;" >本地上传</button>
		    	</div>
		    	<div class="image_list" style="margin-top:32px;"><i class="am-icon-refresh am-icon-spin am-icon-sm" style="margin-top:255px"></i></div>
				<div class="ima_showbutton">
					
				</div>
		    </div>
		    <button type="submit" class="am-btn am-btn-secondary am-disabled" data-am-modal-close="" id="edit_image" data-id="" data-edit="0">确认选择</button>
		    <button type="reset" class="am-btn am-btn-secondary" style="width:98px;" data-am-modal-close="" class="modal-close">取&nbsp;&nbsp;消</button>
		</div>
        
	</div>
	<!--回复图片项 end-->
	
	<script>
		$(function(){
			//选择图文
			$('.news_content_box').on('mouseover','.newsDesc',function(){
				$('.chooseNew').hide();
				$('.choose').siblings('.chooseNew').show();
				$(this).children('.appmsg_content').css('border','1px solid #5eb95e');
				$('.choose').css('border','1px solid #e7e7eb');
			});
			$('.news_content_box').on('mouseout','.newsDesc',function(){
				$('.chooseNew').hide();
				$('.choose').siblings('.chooseNew').show();
				$('.newsDesc .appmsg_content').css('border','1px solid #e7e7eb');
			})

			$('.news_content_box').on('click','.newsDesc',function(){
				$('.newsbox .appmsg_content').removeClass('chooseicon');
				$('.newsbox .appmsg_content').removeClass('choose');
				$('.chooseNew').hide();
				$(this).children('.chooseNew').show();
				$(this).children('.chooseNew').html('<div class="choose_icon"></div>');
				$(this).children('.appmsg_content').addClass('choose');
				$('#edit_news').removeClass('am-disabled');
			});

			$('.getMaterial').click(function(){
				$('.newsbox').remove();
				$('.news_content_box').html('<div class="loading mT"><i class="am-icon-refresh am-icon-spin am-icon-md"></i> 获取中,请稍候</div>');
			});
			//图文列表
			$('.type_news').click(function(){
				
				var news_content_length= $('.news_content_box').html().length;
				$('.type_news').ajaxSubmit({
					data:{"type":3},
					type:'post',
					url:'index.php?m=Admin&c=Weixin&a=wxmaterialgetnewsjson',
					beforeSubmit:function(){
						if(news_content_length>129){
							return false;
						};
					},
					success:function(data){
						var $newsList = data.item;
						var content = '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 0){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item" id=""><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item" id=""><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover" id=""><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						content += '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 1){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item"><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						content += '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 2){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item '+$newsList[i]['media_id']+'" id=""><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						$('.news_content_box').html(content);
						$('#material_up').attr('data-start',0);
						$('#material_down').attr('data-start',10);
						$('#material_up').attr('disabled',true);
						$('#material_down').attr('disabled',false);
						if($newsList.length<data.total_count){
							$('#material_up').css('display','block');
							$('#material_down').css('display','block');
						}else{
							$('#material_up').css('display','none');
							$('#material_down').css('display','none');
						}
						
					}
				});
			});
			
			//重新获取图片
			$('#image_agin').click(function(){
			
				$('.show_image').remove();
				$('.image_list').html('<i class="am-icon-refresh am-icon-spin am-icon-sm" style="margin-top:255px"></i>');
			
			})
			
			//图片模态框显示
			$('.image_model').click(function(){
			$('.image_model').ajaxSubmit({
				url:"index.php?m=Admin&c=Weixin&a=wxgetimagejson",
				type:'get',
				//data:{'start':$('#next_image').attr('data-start')},
				beforeSubmit:function(){
					if($('.image_list').html().length>80){
								return false;
							}
				},
				success:function(data){
					var $image_array = data.item; 
					var image_show = "";
					for(var i =0;i< $image_array.length;i++){
						image_show +='<div class="show_image"><div class="selected_mask"><div class="selected_mask_inner"></div><div class="selected_mask_icon"></div></div><img src="'+'{$TencentPicturePre}'+$image_array[i]['url']+'" alt="" data-id ="'+$image_array[i]['media_id']+'" class="selected_image"></div>';
					}
					$('.image_list').html(image_show);
					if($image_array.length<data.total_count){
						$('#next_image').css('display','block');
						$('#last_image').css('display','block');
					}else{
						$('#next_image').css('display','none');
						$('#last_image').css('display','none');
					}
				},
				error:function(){
					console.log("失败");
				}
			});
			$('#next_image').attr('data-start',20);
			$('#last_image').attr('data-start',0);
	})
	
	
		});
//下一页图片
$("#next_image").click(function(){
		$('.show_image').remove();
		$('.image_list').html('<i class="am-icon-refresh am-icon-spin am-icon-sm" style="margin-top:255px"></i>');
		$.ajax({
				url:"index.php?m=Admin&c=Weixin&a=wxgetimagejson",
				type:'get',
				data:{'start':$('#next_image').attr('data-start')},
				success:function(data){
					var $image_array = data.item; 
					var image_show = "";
					for(var i =0;i< $image_array.length;i++){
						image_show +='<div class="show_image"><div class="selected_mask"><div class="selected_mask_inner"></div><div class="selected_mask_icon"></div></div><img src="'+'{$TencentPicturePre}'+$image_array[i]['url']+'" alt="" data-id ="'+$image_array[i]['media_id']+'" class="selected_image"></div>';
					}
					$('.image_list').html(image_show);
					if($image_array!=''){
						var next_image = parseInt($('#next_image').attr('data-start'));
						var next_image_start = next_image+20;
						$('#next_image').attr('data-start',next_image_start);
						var last_image = parseInt($('#last_image').attr('data-start'));
						var last_image_start =	next_image-20;
						$('#last_image').attr('data-start',last_image_start);
						$('#last_image').attr('disabled',false);
					}else{
						$('.image_list').html('<div style="margin-top:255px;">没有了</div>');
						$('#next_image').attr('disabled',true);
						var rest_last_image = parseInt($('#last_image').attr('data-start'))+20;
						$('#last_image').attr('data-start',rest_last_image);
					}
				},
			});
})
//上一页图片
$("#last_image").click(function(){
	$('.show_image').remove();
		$('.image_list').html('<i class="am-icon-refresh am-icon-spin am-icon-sm" style="margin-top:255px"></i>');
		$.ajax({
				url:"index.php?m=Admin&c=Weixin&a=wxgetimagejson",
				type:'get',
				data:{'start':$('#last_image').attr('data-start')},
				success:function(data){
					var $image_array = data.item; 
					var image_show = "";
					for(var i =0;i< $image_array.length;i++){
						image_show +='<div class="show_image"><div class="selected_mask"><div class="selected_mask_inner"></div><div class="selected_mask_icon"></div></div><img src="'+'{$TencentPicturePre}'+$image_array[i]['url']+'" alt="" data-id ="'+$image_array[i]['media_id']+'" class="selected_image"></div>';
					}
					$('.image_list').html(image_show);
					if($("#next_image").attr('disabled')){
						var a = parseInt($("#next_image").attr('data-start'))+20;
						$("#next_image").attr('data-start',a);
						//var b =	parseInt($("#last_image").attr('data-start'))+20;
						//$("#last_image").attr('data-start',b);
					}
					var last_image = parseInt($('#last_image').attr('data-start'));
					var last_image_start = last_image-20;
					$('#last_image').attr('data-start',last_image_start);
					var next_image = parseInt($('#next_image').attr('data-start'));
					var next_image_start = next_image-20;
					$('#next_image').attr('data-start',next_image_start);
					$('#next_image').attr('disabled',false);
					if($('#last_image').attr('data-start')<0){
						$('#last_image').attr('disabled',true);
					}
				},
			});
})


//上传图片
$('.file_image').click(function(){
	$('.addimage').click();
});
$('#upload_image').change(
	function(){
	$('.image_table .show_image').eq(0).before('<div class="show_image"><span class="text_center"><i class="am-icon-refresh am-icon-spin"></i> 上传中</span></div>');
			if($('.image_table .show_image').length>=20){
				$('.image_table .show_image:last-child').remove();
			}
			$('#edit_image').attr('disabled',true);
			$('.file_image').attr('disabled',true);
			$('.file_image').html('<i class="am-icon-spinner am-icon-spin"></i> 上传中');
			$('#image_upload').ajaxSubmit({
				dataType:'json',
				success:function(data){
					if(data.info == 1){
						$('#edit_image').attr('disabled',false);
						$('.file_image').attr('disabled',false);
						$('.file_image').html('本地上传');
						
					$('.image_table .show_image').eq(0).html('<div class="selected_mask"><div class="selected_mask_inner"></div><div class="selected_mask_icon"></div></div><img src='+'{$TencentPicturePre}'+data.image_url+' alt="" class="selected_image">');
					}
				}
			});
		}
	
	);

//下一页图文
$('#material_down').click(function(){
	$('.newsbox').remove();
	$('.news_content_box').html('<div class="loading mT" style="display:block;"><i class="am-icon-refresh am-icon-spin am-icon-md"></i> 获取中,请稍候</div>');
	var start = $(this).attr('data-start');
	var end   = $(this).attr('data-num');
	$.ajax({
	
		data:{"type":3,"start":start,"end":end},
		type:'post',
		url:'index.php?m=Admin&c=Weixin&a=wxmaterialgetnewsjson',
		success:function(data){
			 
				var $newsList = data.item;
						var content = '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 0){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item" id=""><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item" id=""><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover" id=""><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						content += '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 1){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item"><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						content += '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 2){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item '+$newsList[i]['media_id']+'" id=""><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						$('.news_content_box').html(content);
						if(data.list!=''){
											var material_down_start = parseInt($('#material_down').attr('data-start'));
											var material_up_reststart = material_down_start-10;
											$('#material_up').attr('data-start',material_up_reststart);
											var material_down_reststart = material_down_start+10;
											$('#material_down').attr('data-start',material_down_reststart);
											$('#material_up').attr("disabled",false);
										}else{
												$('.news_content_box').html('<div class="loading mT" style="display:block;">没有了...</div>');
												var rest_upstart= parseInt($('#material_up').attr('data-start'))+10;
												$('#material_up').attr('data-start',rest_upstart);
												$('#material_down').attr("disabled",true);
												$('#material_up').attr("disabled",false);
										}
			 
		}
	})
});

//上一页图文
$('#material_up').click(function(){
	$('.newsbox').remove();
	$('.news_content_box').html('<div class="loading mT" style="display:block;"><i class="am-icon-refresh am-icon-spin am-icon-md"></i> 获取中,请稍候</div>');
	var start = $(this).attr('data-start');
	var end   = $(this).attr('data-num');
	$.ajax({
		data:{"type":3,"start":start,"end":end},
		type:'post',
		url:'index.php?m=Admin&c=Weixin&a=wxmaterialgetnewsjson',
		success:function(data){
			 
				var $newsList = data.item;
						var content = '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 0){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item" id=""><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item" id=""><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover" id=""><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						content += '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 1){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item"><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						content += '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 2){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item '+$newsList[i]['media_id']+'" id=""><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						$('.news_content_box').html(content);
						if($('#material_down').attr('disabled')){
							var down_start =  parseInt($('#material_down').attr('data-start'))+10;
							$('#material_down').attr('data-start',down_start);
						}
						$('#material_down').attr('disabled',false);
						var par_start =  parseInt($('#material_up').attr('data-start'))-10;
						$('#material_up').attr('data-start',par_start);
						var down_start = parseInt($('#material_down').attr('data-start'))-10;
						$('#material_down').attr('data-start',down_start);
						if($('#material_up').attr('data-start')<0){
							$('#material_up').attr('disabled',true);
						}
			 
		}
	})
});


//选择图片素材
$('.image_table').on('click','.selected_image',function(){	
	var image_id = $(this).attr('data-id');
	$('#edit_image').attr('data-id',image_id);
	$('.selected_mask').css({'display':'none'});
	$(this).siblings('.selected_mask').css({'display':'block'});
	$(".selected_image").removeClass("choose_image");
	$(this).addClass("choose_image");
	if(image_id!=''){
		$('#edit_image').removeClass('am-disabled');
	}else{
		$('#edit_image').addClass('am-disabled');
	}

});


$('#edit_image').click(function(){
	$('#edit_image').addClass('am-disabled');
	$('.selected_mask').hide();
});
		
</script>
	<!--回复图文项 end-->
	<!--删除的弹窗提醒-->
	<div class="am-modal am-modal-confirm" tabindex="-1" id="my-confirm">
		<div class="am-modal-dialog">
		    <div class="am-modal-bd">
		        您确定要删除这条记录吗？
		    </div>
		    <div class="am-modal-footer">
			    <span class="am-modal-btn" data-am-modal-cancel="">取消</span>
			    <span class="am-modal-btn" data-am-modal-confirm="" data-id="">确定</span>
		    </div>
		</div>
	</div><footer class="admin-content-footer">
	<hr>
	<p class="am-padding-left">版权</p>
</footer>
</div>
<!-- content end -->

<link rel="stylesheet" href="__STATIC__/weixin/assets/sell/css/wxmenu.css" >
<script type="text/javascript" src="__STATIC__/weixin/assets/sell/js/jquery.form.js"></script>
<script src="__STATIC__/weixin/assets/sell/js/jquery.qqFace.js"></script>
	<script type="text/javascript" src="__STATIC__/weixin/wysiwyg/js/wysiwyg.js"></script>
    <script type="text/javascript" src="__STATIC__/weixin/wysiwyg/js/wysiwyg-editor.js"></script>
    <script type="text/javascript" src="__STATIC__/weixin/wysiwyg/js/demo.js"></script>
<script>
//关键词添加上传图片
$('#msgSendImgUploadBt').click(function(){
	$('#media_image').click();
	$('.add_warming').hide();
	$('.image_del').hide();
	$('.image_show').show();
	$('.del_hide').html('<div class="image_show show_place"><div class="waiting"><i class="am-icon-refresh am-icon-spin am-icon-md "></i> 上传中,请稍候</div></div>');

});
$('#media_image').change(function(){
	$('.image_cover').hide();
	$('.del_hide').show();
	$('.image_show,.image_show .waiting').show();
	$('#imageUpload').ajaxSubmit({
		dataType:'json',
		success:function(data){
			
			$('.del_hide').html('<div class="image_show show_place"><div class="waiting"><i class="am-icon-refresh am-icon-spin am-icon-md"></i> 上传中,请稍候</div></div><a href="javascript:void(0);" class="media_del image_del" title="图片" data-type="2" display="none">删除</a>');
			$('.image_show').html('<img src="'+data.image_url+'" class="material_image" data-media_id="'+data.media_id+'"/>');
			$('.image_show').show();
			$('.image_del').show();
			$('#media_image').replaceWith($('#media_image').clone(true));
			var get_image=$('.material_image').attr('src');
			var media_id=$('.material_image').attr('data-media_id');
			$('#check_keyword').attr('data-type',2);
			$('#check_keyword').attr('data-src',get_image);
			$('#check_keyword').attr('data-media_id',media_id);
			$('#check_keyword').attr('data-title','');
			$('#check_keyword').attr('data-content','');
		},
		error:function(data){

		}
	});
});
//素材选择
$('.tab_nav a').click(function(){
	$('.tab_nav').removeClass('selected');
	$(this).parent('.tab_nav').addClass('selected');
	var content = $(this).parent('.tab_nav').attr('data-tab');
	$('.tab_content').hide();
	$(''+content+'').parent('.tab_content').show();
		
});

//删除回复内容已选素材
$('.media_del').click(function(){
	$(this).hide();
	var keytype = $(this).attr('data-type');
	if(keytype == 3){
		$('.news_cover').show();
		$('.news_show').hide();
		$('.news_show').html('');
		$('.news_del').hide();
		$('#check_keyword').attr('data-url','');
		$('#check_keyword').attr('data-src','');
		$('#check_keyword').attr('data-type','');
		$('#check_keyword').attr('data-media_id','');
		$('#check_keyword').attr('data-title','');
	}else if(keytype == 2){
		$('.image_cover').show();
		$('.image_show').hide();
		$('.image_show').html('<div class="waiting"><i class="am-icon-refresh am-icon-spin am-icon-md "></i> 上传中,请稍候</div>');
		$('#check_keyword').attr('data-url','');
		$('#check_keyword').attr('data-src','');
		$('#check_keyword').attr('data-type','');
		$('#check_keyword').attr('data-media_id','');

	}
		
});

$('.del_hide').on('click','.image_del',function(){
	$('.image_cover').show();
		$('.image_show').hide();
		$('.del_hide').hide();
		$('.image_show').html('<div class="waiting"><i class="am-icon-refresh am-icon-spin am-icon-md "></i> 上传中,请稍候</div>');
		$('#check_keyword').attr('data-url','');
		$('#check_keyword').attr('data-src','');
		$('#check_keyword').attr('data-type','');
		$('#check_keyword').attr('data-media_id','');
});

$('#editor1').on('blur',function(){
	var get_content=$(this).val();
	if(get_content==''){
		$('#check_keyword').attr('data-type','');
		$('#check_keyword').attr('data-content',get_content);
	}else{
		$('#check_keyword').attr('data-type',1);
		$('#check_keyword').attr('data-content',get_content);
	}
});
$('#editor1').focus(function(){
	$('.add_warming').hide();
});
//关键词添加修改的按钮获取不同类型的参数
$('#edit_text').click(function(){
	if($(this).attr('data-edit') == 0){
		var content=$('#text').html();
		$('#check_keyword').attr('data-type',1);
		$('#check_keyword').attr('data-content',content);
		$('#check_keyword').attr('data-src','');
		$('#check_keyword').attr('data-url','');
		$('#check_keyword').attr('data-media_id','');
		$('#check_keyword').attr('data-title','');
		$('.default').prop('checked',false);
		$('.welcome').prop('checked',false);
	}
	
});
$('.add_text').click(function(){
	var content=$('#text').html();
	$('#check_keyword').attr('data-type',1);
	$('#check_keyword').attr('data-content',content);
	$('#check_keyword').attr('data-src','');
	$('#check_keyword').attr('data-url','');
	$('#check_keyword').attr('data-media_id','');
	$('#check_keyword').attr('data-title','');
});
$('#edit_image').click(function(){
		var materialmedia_id = $('.choose_image').attr('data-id');		
		var materialimage_url = $('.choose_image').attr('src');
		$('.image_cover').hide();
		$('.image_show,.image_del').show();
		$('.del_hide').show();
		$('.del_hide').html('<div class="image_show show_place"><img src="'+materialimage_url+'" class="material_image" data-media_id=""/></div><a href="javascript:void(0);" class="media_del image_del" title="图片" data-type="2" display="none">删除</a>');
		$('.image_show').show();
		$('.image_del').show();
		$('.material_image').attr('data-media_id',materialmedia_id);
		var get_image=$('.material_image').attr('src');
		var media_id=$('.material_image').attr('data-media_id');
		$('#check_keyword').attr('data-type',2);
		$('#check_keyword').attr('data-src',get_image);
		$('#check_keyword').attr('data-media_id',media_id);
		$('#check_keyword').attr('data-title','');
		$('#check_keyword').attr('data-content','');
		$('#check_keyword').attr('data-url','');

});
$('.add_image').click(function(){
	var get_image=$('.material_image').attr('src');
	var media_id=$('.material_image').attr('data-media_id');
	$('#check_keyword').attr('data-type',2);
	$('#check_keyword').attr('data-src',get_image);
	$('#check_keyword').attr('data-media_id',media_id);
	$('#check_keyword').attr('data-title','');
	$('#check_keyword').attr('data-content','');
	$('#check_keyword').attr('data-url','');
	
});
$('#edit_news').click(function(){
	if($(this).attr('data-edit') == 0){
		var title = $('.choose .appmsg_title').eq(0).text();
		var src = $('.choose .appmsg_thumb_wrp').eq(0).css('background-image');
		var media_id =$('.choose').attr('data-id');
		var news = $('.choose').html();
		$('.news_cover').hide();
		$('.news_show').html('<div class="appmsg_content">'+news+'</div>');
		$('.news_show,.news_del').show();
		$('#check_keyword').attr('data-type',3);
		$('#check_keyword').attr('data-title',title);
		$('#check_keyword').attr('data-url',src);
		$('#check_keyword').attr('data-media_id',media_id);
		$('.news_show').attr('data-id',media_id)
		$('#check_keyword').attr('data-src','');
		$('#check_keyword').attr('data-content','');
	}
});
$('.add_appmsg').click(function(){
	var title = $('.show_place .appmsg_title').eq(0).text();
	var src = $('.show_place .appmsg_thumb_wrp').eq(0).css('background-image');
	var media_id =$('.news_show').attr('data-id');
	$('#check_keyword').attr('data-type',3);
	$('#check_keyword').attr('data-title',title);
	$('#check_keyword').attr('data-url',src);
	$('#check_keyword').attr('data-src','');
	$('#check_keyword').attr('data-content','');
	$('#check_keyword').attr('data-media_id',media_id);
});


//解决下拉选择框的冲突
AMUI.plugin('mySelected', AMUI.selected);
$('#my_select').mySelected();
</script>
<script type="text/javascript">
//获取推荐关键词
$('.recommend_keyword').children().click(function(){
	var get_rk_val=$(this).children().val();
	$('#input_keyword').val(get_rk_val);
	$('.add_warming').hide();

});

//处理文字回复内容
$('.type_text').click(function(){
	$('#doc-ta-2').val('');
	if($('#edit_text').attr('data-edit')==1){
		var text_content=$('.editcontent').text();
	}else{
		var text_content=$('#addcontent').text();
		
	}
	$('#doc-ta-2').val(text_content);
});
//重写文字回复内容
$('.reset_text_content').click(function(){
	$('#doc-ta-2').val('');
});



//文字回复内容提交判断
$('#doc-ta-2').mouseout(function(){
	var get_text=$('#doc-ta-2').val();
	if(get_text!=''){
		$('#edit_text').removeClass('am-disabled');
	}else{
		$('#edit_text').addClass('am-disabled');
	}
});

//点击关键词添加时清空图文选择框
$('.del_news_bd').click(function(){
	$('.chooseNew').hide();
	$('.appmsg_content').removeClass('choose');
	$('#edit_news').addClass('am-disabled');

});
//点击关键词添加时清空图片选择框
$('.del_image_bd').click(function(){
	$('.selected_mask').hide();
	$('.selected_image').removeClass('choose_image');
	$('#edit_image').addClass('am-disabled');

});

//重置添加关键词显示的回复内容	
$('.keyword_reset').click(function(){
	$('.add_show').html('');
	$('#check_keyword').attr('data-type','');
	$('#check_keyword').attr('data-title','');
	$('#check_keyword').attr('data-id','');
});
//清空编辑项显示的回复内容
$('#edit_reset').click(function(){
	$('.edit_show').html('');
});
//移除编辑项关键字为空提醒
$('#edit_keyword').blur(function(){
	var warming = $('#edit_keyword').val();
	if(warming==''){
		$('.edit_warming').show();
	}else{
		$('.edit_warming').hide();
	}
});
$('#edit_keyword').focus(function(){
	var warming = $('#edit_keyword').val();
	$('.edit_warming').hide();
});

//移除关键词添加项关键字为空提醒
$('#input_keyword').blur(function(){
	$('.add_warming').hide();
	var warming = $.trim($('#input_keyword').val());
	if(warming==''){
		$('.add_warming').html('关键词不能为空');

		//设定为默认回复 关键词可为空
		if($('.default').prop('checked') == false && $('.welcome').prop('checked') == false){
			$('.add_warming').css({'display':'inline-block'});
		}

	}else{
		$('.add_warming').hide();
	}
});
//判断是否默认回复 选择是否显示提示
$('#input_keyword').focus(function(){
	var warming = $.trim($(this).val());
	if($('.default').prop('checked') == true || $('.welcome').prop('checked') == true){
		$('.add_warming').hide();
	}else if(warming != ""){
		$('.add_warming').hide();
	}
	
});


$('.add_keyword_bt').click(function(){
	$('.add_warming').hide();
	$('.tab_img').removeClass('edit_selected');
	$('.tab_text').removeClass('edit_selected');
	$('.tab_appmsg').removeClass('edit_selected');
});
//全选按钮
$('#selectAll').click(function(){
	if($('#selectAll').prop('checked')==true){
		$('.cbox').prop('checked',true);
	}else{
		$('.cbox').prop('checked',false);
	}
			                        
});	
//删除选中
$('#delete_all').click(function(){
	var a = $('input[name="idarr[]"]');//获取name="idarr[]"所有的input
	var length = a.length;//获取input的总数
	var b = new Array();
		for(var i = 0;i<length;i++){
		    if(a.eq(i).prop('checked')==true){
		              b[i]=a.eq(i).val();
		    }
		}
	if(b!=''){
	  	$("#fq_true_confirm_info").text('您确定要删除选中的记录吗？');
		$('#fq_true_confirm').modal({
			relatedTarget: this,
			onConfirm: function(options) {
			
			    $.ajax({
			        type:'post',
			        url:"index.php?m=Admin&c=Weixin&a=wxautoreplydeleteall",
			        data:{'id':b},
			        success:function(data){ 
			           if(data.status==1){
			           	$("#fq_alert_info").html("删除成功");
						$('#fq_alert').modal();
						window.location.href = "index.php?m=Admin&c=Weixin&a=wxautoreply";
			           }
			        }
			    });
			},
				onCancel: function() {}
		});

	}else{
		$("#fq_alert_info").html("您未选中任何要删除的记录");
		$('#fq_alert').modal();
	}
  	
});

//点击默认回复
$('.default,.welcome').click(function(){

	if($(this).prop('checked') == true){
		$('.add_warming').hide();
	}

});


//根据data_edit是否为1判断性提交修改或添加关键词
$('#check_keyword').click(function(){
	var data_edit=$(this).attr('data-edit');
	var edit_id=$(this).attr('data-id');
	var show_place=$('.show_place').html();
	var content = $(this).attr('data-content');
	var type = $(this).attr('data-type');
	var src = $(this).attr('data-src');
	var url = $(this).attr('data-url');
	var title = $(this).attr('data-title');
	var media_id = $(this).attr('data-media_id');
	var keyword = $.trim($('#input_keyword').val());
	var is_default = 0;
	var is_welcome = 0;

	if(keyword==''){
		if($('.default').prop('checked') == false && $('.welcome').prop('checked') == false){
			$('.add_warming').text('关键词不能为空');
			$('.add_warming').css({'display':'inline-block'});
			return false;
		}else{
			$('.add_warming').text('');
			$('.add_warming').hide();
			if($('.default').prop('checked') == true){
				is_default = 1;
			}
			if($('.welcome').prop('checked') == true){
				is_welcome = 1;
			}
			
		}
		
	}else{
		$('.add_warming').text('');
		$('.add_warming').hide();
		if($('.default').prop('checked') == true){
			is_default = 1;
		}
		if($('.welcome').prop('checked') == true){
			is_welcome = 1;
		}
	}

	if(type==1){
		if(content!=''){
			$('#check_keyword').html('<i class="am-icon-spinner am-icon-spin"></i> 提交中');
			if(data_edit!=1){
				$.ajax({
					url:"index.php?m=Admin&c=Weixin&a=wxautoreplyadd",
					type:'post',
					dataType:'json',
					data:{"type":type,"media_id":media_id,"src":TencentPICjs(src),"keyword":keyword,"content":content,"title":title,"url":url,"default":is_default,"welcome":is_welcome},
					success:function(data){
						if(data.info == 1){
							$('#check_keyword').html('提交保存');
							location.reload();
						}else if(data.info == -1){
							$("#fq_alert_info").html("添加失败，关键词已存在");
							$('#fq_alert').modal();
							$('#check_keyword').html('提交保存');

						}else{
							$("#fq_alert_info").html("添加失败");
							$('#fq_alert').modal();
							$('#check_keyword').html('提交保存');
						}
					}
				});
			}else{
					$.ajax({
						url:"index.php?m=Admin&c=Weixin&a=wxautoreplyedit",
						type:'post',
						dataType:'json',
						data:{"edittype":type,"editmedia_id":media_id,"editsrc":TencentPICjs(src),"editkeyword":keyword,"editcontent":content,"edittitle":title,"editurl":url,'edit_id':edit_id,"default":is_default,"welcome":is_welcome},
						success:function(data){
							if(data.info ==1){
								$('#check_keyword').html('提交保存');
								self.location='index.php?m=Admin&c=Weixin&a=wxautoreply';
							}else if(data.info == -1){
								$("#fq_alert_info").html('修改失败，关键词"'+data.keyword+'"已存在');
								$('#fq_alert').modal();
								$('#check_keyword').html('提交保存');
							}else{
								$("#fq_alert_info").html('修改失败');
								$('#fq_alert').modal();
								$('#check_keyword').html('提交保存');
							}
						}
						
					});
				}
				
			}else{
				$('.add_warming').html('回复内容不能为空');
				$('.add_warming').css({'display':'inline-block'});
				return false;
			}		
	}else if(type==2){
			if(src!=''){
				$('.add_warming').hide();
				$('#check_keyword').html('<i class="am-icon-spinner am-icon-spin"></i> 提交中');
				if(data_edit!=1){
					$.ajax({
						url:"index.php?m=Admin&c=Weixin&a=wxautoreplyadd",
						type:'post',
						dataType:'json',
						data:{"type":type,"media_id":media_id,"src":TencentPICjs(src),"keyword":keyword,"content":content,"title":title,"url":url,"default":is_default,"welcome":is_welcome},
						success:function(data){
							if(data.info == 1){
								$('#check_keyword').html('提交保存');
								location.reload();
							}else if(data.info == -1){
								$("#fq_alert_info").html("添加失败，关键词已存在");
								$('#fq_alert').modal();
								$('#check_keyword').html('提交保存');
							}else{
								$("#fq_alert_info").html("添加失败");
								$('#fq_alert').modal();
								$('#check_keyword').html('提交保存');
							}
						}
					
					});
				}else{
					$.ajax({
						url:"index.php?m=Admin&c=Weixin&a=wxautoreplyedit",
						type:'post',
						dataType:'json',
						data:{"edittype":type,"editmedia_id":media_id,"editsrc":TencentPICjs(src),"editkeyword":keyword,"editcontent":content,"edittitle":title,"editurl":url,'edit_id':edit_id,"default":is_default,"welcome":is_welcome},
						success:function(data){
							if(data.info ==1){
								$('#check_keyword').html('提交保存');
								self.location='index.php?m=Admin&c=Weixin&a=wxautoreply';
							}else if(data.info == -1){
								$("#fq_alert_info").html('修改失败，关键词"'+data.keyword+'"已存在');
								$('#fq_alert').modal();
								$('#check_keyword').html('提交保存');
							}else{
								$("#fq_alert_info").html('修改失败');
								$('#fq_alert').modal();
								$('#check_keyword').html('提交保存');
							}
						}
						
					});
				}
				
			}else{
				$('.add_warming').html('回复内容不能为空');
				$('.add_warming').css({'display':'inline-block'});
				return false;
			}		
	}else{
			if(url!=''){
				$('.add_warming').hide();
				$('#check_keyword').html('<i class="am-icon-spinner am-icon-spin"></i> 提交中');
				if(data_edit!=1){
					$.ajax({
						url:"index.php?m=Admin&c=Weixin&a=wxautoreplyadd",
						type:'post',
						dataType:'json',
						data:{"type":type,"media_id":media_id,"src":TencentPICjs(src),"keyword":keyword,"content":content,"title":title,"url":url,"default":is_default,"welcome":is_welcome},
						success:function(data){
							if(data.info ==1){
								$('#check_keyword').html('提交保存');
								location.reload();
							}else if(data.info = -1){
								$("#fq_alert_info").html("添加失败，关键词已存在");
								$('#fq_alert').modal();
								$('#check_keyword').html('提交保存');
							}else{
								$("#fq_alert_info").html("添加失败");
								$('#fq_alert').modal();
								$('#check_keyword').html('提交保存');
							}
						}
					
					});
				}else{
					$.ajax({
						url:"index.php?m=Admin&c=Weixin&a=wxautoreplyedit",
						type:'post',
						dataType:'json',
						data:{"edittype":type,"editmedia_id":media_id,"editsrc":TencentPICjs(src),"editkeyword":keyword,"editcontent":content,"edittitle":title,"editurl":url,'edit_id':edit_id,"default":is_default,"welcome":is_welcome},
						success:function(data){
							if(data.info == 1){
								$('#check_keyword').html('提交保存');
								self.location='index.php?m=Admin&c=Weixin&a=wxautoreply';
							}else if(data.info == -1){
								$("#fq_alert_info").html('修改失败，关键词"'+data.keyword+'"已存在');
								$('#fq_alert').modal();
								$('#check_keyword').html('提交保存');
							}else{
								$("#fq_alert_info").html('修改失败');
								$('#fq_alert').modal();
								$('#check_keyword').html('提交保存');
							}
						}
						
					});
				}
				
			}else{
				$('.add_warming').html('回复内容不能为空');
				$('.add_warming').css({'display':'inline-block'});
				return false;
			}
	}
	
});

//选择关键词类型
function select_type(){
	$('#keyword_list').css("text-align","center");
	$('#keyword_list').css("width","100%");
	$('#keyword_list').html('<div style="width:100%;height:100%;padding-top:110px;"><i class="am-icon-refresh am-icon-spin"></i>&nbsp;获取关键字列表中,请稍候!</div>');
	var select_type = $('#my_select option:selected').val();
	$('.keylist_sum').html('展示列表 (共&nbsp;&nbsp;条)');
	$.get("/wxautoreply/type_show.html",{'select_type':select_type},function(data){
	$('#keyword_list').html(data);
	})
}
		
//删除关键字
$('.del').click(function(){
	var id = $(this).attr('data-id');
  	$("#fq_true_confirm_info").text('您确定要删除选中的记录吗？');
	$('#fq_true_confirm').modal({
		relatedTarget: this,
		onConfirm: function(options) {
			$.ajax({
				type:'get',
				url:"index.php?m=Admin&c=Weixin&a=wxautoreplydeletekeyword",
				data:{'id':id},
				success:function(data){
					if(data.info == 1){
						$("#fq_alert_info").html("删除成功");
						$('#fq_alert').modal();
						window.location.href = "index.php?m=Admin&c=Weixin&a=wxautoreply";
						
					}else{
						$("#fq_alert_info").html("删除失败");
						$('#fq_alert').modal();
					}
				}
			});
		}
	});	
});
//导航变化
$('.keylist').click(function(){
	$('.edit_text').html('添加关键词');
	$('#edit_news').attr('data-edit',0);
	$('#edit_image').attr('data-edit',0);
	$('#edit_text').attr('data-edit',0);
	$('#check_keyword').attr('data-edit',0);
	$('#input_keyword').val('');
	$('#editor1').val('');
	$('.js_textArea').parent().hide();
	$('.js_imgArea').parent().hide();
	$('.js_appmsgArea').parent().show();
	$('.tab_img').removeClass('selected');
	$('.tab_text').removeClass('selected');
	$('.tab_appmsg').addClass('selected');
	$('.wysiwyg-editor').html('');
	$('.news_show').html('');
	$('.news_cover').show();
	$('.news_del').hide();
	$('.image_del').css({'display':'none'});
	$('.image_cover').show();
	$('.image_show').hide();
	$('.del_hide').hide();
	$('.default,.welcome').prop('checked',false);
	$('.image_show').html('<div class="waiting"><i class="am-icon-refresh am-icon-spin am-icon-md "></i> 上传中,请稍候</div>');
});

//获取编辑关键词
$('.edit').click(function(){
	
	$('#check_keyword').attr('data-edit',1);
	$('.edit_warming').hide();
	$('.keyword_nav li').removeClass('am-active');
	$('.move_edit').addClass('am-active');
	$('.nav_content').children().removeClass('am-active');
	$('#tab2').addClass('am-active');
	$('#tab2').addClass('am-in');
	$('.edit_text').html('编辑关键词');
	$('.del_hide').show();

	var edit_keyword=$(this).attr('data-editkeyword');
	var edit_type=$(this).attr('data-edittype');
	var edit_content=$(this).attr('data-content');
	var edit_id=$(this).attr('data-editid');
	var edit_src=$(this).attr('data-editsrc');
	var edit_media_id=$(this).attr('data-editmedia_id');
	var edit_title=$(this).attr('data-edittitle');

	var edit_default = $(this).attr("data-default");
	var edit_welcome = $(this).attr("data-welcome");

	$('#input_keyword').val(edit_keyword);

	//如为默认回复 则选中 否则则取消
	if(edit_default == 1){
		$('.default').prop('checked',true);
	}else{
		$('.default').prop('checked',false);
	}
	if(edit_welcome == 1){
		$('.welcome').prop('checked',true);
	}else{
		$('.welcome').prop('checked',false);
	}

	if(edit_type==1){
		$('.tab_img').removeClass('selected');
		$('.tab_appmsg').removeClass('selected');
		$('.tab_text').addClass('selected');
		$('#check_keyword').attr('data-type',1);
		$('#check_keyword').attr('data-id',edit_id);
		$('#check_keyword').attr('data-content',edit_content);
		$('#check_keyword').attr('data-src','');
		$('#check_keyword').attr('data-url','');
		$('#check_keyword').attr('data-title','');
		$('#check_keyword').attr('data-media_id','');
		$('.tab_panel').children().hide();
		$('.js_textArea').parent().show();
		$('.wysiwyg-editor').html(edit_content);

	}else if(edit_type==2){
		$('.tab_text').removeClass('selected');
		$('.tab_appmsg').removeClass('selected');
		$('.tab_img').addClass('selected');
		$('#check_keyword').attr('data-type',2);
		$('#check_keyword').attr('data-editsrc');
		$('#check_keyword').attr('data-id',edit_id);
		$('#check_keyword').attr('data-content','');
		$('#check_keyword').attr('data-src',edit_src);
		$('#check_keyword').attr('data-url','');
		$('#check_keyword').attr('data-title','');
		$('#check_keyword').attr('data-media_id',edit_media_id);
		$('.tab_panel').children().hide();
		$('.js_imgArea').parent().show();
		$('.image_cover').hide();
		$('.image_del').show();
		$('.image_show').show();
		$('.image_show').html('<img src="'+edit_src+'" class="material_image" data-media_id=""/>');
		

	}else if(edit_type==3){
		$('.tab_img').removeClass('selected');
		$('.tab_text').removeClass('selected');
		$('.tab_appmsg').addClass('selected');
		$('#check_keyword').attr('data-type',3);
		$('#check_keyword').attr('data-id',edit_id);
		$('#check_keyword').attr('data-content','');
		$('#check_keyword').attr('data-url',edit_src);
		$('#check_keyword').attr('data-src','');
		$('#check_keyword').attr('data-media_id',edit_media_id);
		$('#check_keyword').attr('data-title',edit_title);
		$('.news_cover').hide();
		$('.tab_panel').children().hide();
		$('.js_appmsgArea').parent().show();
		$('.news_show').html("<div class='keylist_news' style='background-image:"+edit_src+"'></div><p class='keylist_title'>"+edit_title+"</p>");
		$('.news_del').show();
	}
	
	$('#edit_sub').attr('data-editid',edit_id);
	$('#edit_sub').attr('data-content',edit_content);
	

});	

$('#edit_reset').click(function(){
	$('#edit_warm').html('');	
});
	
//开启自动回复	
$('#auto_replay').click(function(){
	$('#replay_spinner').show();
	if($('#auto_replay').prop('checked')==true){
		$.ajax({
			url:"index.php?m=Admin&c=Weixin&a=wxautoreplyisopen",
			type:'get',
			data:{'is_open':$('#auto_replay').val()},
			success:function(data){
				if(data.info=1){
					$('#auto_replay').val(1);
					$("#fq_alert_info").html("成功启用自动回复！");
					$('#fq_alert').modal();
				}
				$('#replay_spinner').hide();
			}
		});
	}else{
		$('#auto_replay').val(0);
		$.ajax({
			url:"index.php?m=Admin&c=Weixin&a=wxautoreplyisopen",
			type:'get',
			data:{'is_open':1},
			success:function(data){
				$("#fq_alert_info").html("自动回复已关闭！");
				$('#fq_alert').modal();
				$('#replay_spinner').hide();
			}
		});
	}
			
});


$(".am-selected-text").eq(0).click(function(){

window.location.href = "/wxautoreply/index.html";
});	

/*处理图片tentcent*/
function TencentPICjs(img)
{
	var  m = img.replace("{$TencentPicturePre}","");  
	return m;
}		
		
</script>